
var aux = 'ok';
Ext.define('proyectos.MiembrosForm', {
    extend: 'Ext.form.Panel',
    alias: 'widget.MiembrosForm',
    
    requires: ['Ext.form.field.Text'],

    initComponent: function(){
        Ext.apply(this, {
            activeRecord: null,
            iconCls: 'icon-miembros',
            frame: true,
            defaultType: 'textfield',
            bodyPadding: 15,
            fieldDefaults: {
                anchor: '100%',
            },
            items: [{
                fieldLabel: 'Id',
                hidden: true,
                name: 'id',
                type: 'int',
            },{
                fieldLabel: 'Nombre Usuario',
                name: 'nombreUsuario',
                fieldStyle: 'background-color: transparent; border: none; background-image: none;',
                allowBlank: false               
				
            },{
                fieldLabel: 'Nombre',
                fieldStyle: 'background-color: transparent; border: none; background-image: none;',
                name: 'nombre',
            }, {
                fieldLabel: 'Apellido',
                fieldStyle: 'background-color: transparent; border: none; background-image: none;',
                name: 'apellido',
            }, {
                fieldLabel: 'Telefono',
                name: 'telefono',
                fieldStyle: 'background-color: transparent; border: none; background-image: none;',
                type: 'int',
            }, {
                fieldLabel: 'Nº Documento',
                name: 'nroDocumento',
                fieldStyle: 'background-color: transparent; border: none; background-image: none;',
                type: 'int',
            },{
                fieldLabel: 'Email',
                name: 'email',
                allowBlank: false,
                fieldStyle: 'background-color: transparent; border: none; background-image: none;',
                vtype: 'email'
            },{
                fieldLabel: 'Fecha Creacion',
                name: 'fechaCreacion',
                itemId: 'f_fechaCreacion',
                hidden: true,
            }],
            dockedItems: [
            {
				xtype: 'toolbar',
				items: [
				{}]
			},
            {
				weight: 1,
                xtype: 'toolbar',
                dock: 'bottom',
                items: ['->', {
                    iconCls: 'icon-reset',
                    text: '<b>Reset</b>',
                    tooltip:'Resetear el formulario',
                    scope: this,
                    handler: this.onReset
                }]
            }]
        });
        this.callParent();
    },

    setActiveRecord: function(record){
        this.activeRecord = record;
        if (record) {
						
		                      
            this.getForm().loadRecord(record);
        } else {
				  			           
            this.getForm().reset();
        }
    },




	/*onRol: function(){
			var form = this.getForm();
			this.fireEvent('roles', form.getValues(true));
            
	},*/

    onReset: function(){
        this.setActiveRecord(null);
        this.getForm().reset();
        this.fireEvent('reset'); 
    },
    
 
    
});
